home *** CD-ROM | disk | FTP | other *** search
/ Freelog 125 / Freelog_MarsAvril2015_No125.iso / Musique / Quod Libet / quodlibet-3.3.0-installer.exe / bin / json / tests / test_check_circular.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2014-12-31  |  2KB  |  53 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.7)
  3.  
  4. from json.tests import PyTest, CTest
  5.  
  6. def default_iterable(obj):
  7.     return list(obj)
  8.  
  9.  
  10. class TestCheckCircular(object):
  11.     
  12.     def test_circular_dict(self):
  13.         dct = { }
  14.         dct['a'] = dct
  15.         self.assertRaises(ValueError, self.dumps, dct)
  16.  
  17.     
  18.     def test_circular_list(self):
  19.         lst = []
  20.         lst.append(lst)
  21.         self.assertRaises(ValueError, self.dumps, lst)
  22.  
  23.     
  24.     def test_circular_composite(self):
  25.         dct2 = { }
  26.         dct2['a'] = []
  27.         dct2['a'].append(dct2)
  28.         self.assertRaises(ValueError, self.dumps, dct2)
  29.  
  30.     
  31.     def test_circular_default(self):
  32.         self.dumps([
  33.             set()], default = default_iterable)
  34.         self.assertRaises(TypeError, self.dumps, [
  35.             set()])
  36.  
  37.     
  38.     def test_circular_off_default(self):
  39.         self.dumps([
  40.             set()], default = default_iterable, check_circular = False)
  41.         self.assertRaises(TypeError, self.dumps, [
  42.             set()], check_circular = False)
  43.  
  44.  
  45.  
  46. class TestPyCheckCircular(TestCheckCircular, PyTest):
  47.     pass
  48.  
  49.  
  50. class TestCCheckCircular(TestCheckCircular, CTest):
  51.     pass
  52.  
  53.